<?php
/**
 * Copyright 2011  SURFfoundation
 * 
 * This file is part of ESCAPE.
 * 
 * ESCAPE is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ESCAPE is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with ESCAPE.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information:
 * http://escapesurf.wordpress.com/
 * http://www.surffoundation.nl/
 * 
 * Contact: d.vierkant@utwente.nl
 * 
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3
 */
?>
<?php
/**
 * Extractor
 * 
 * Base class for metadata extractors.
 */
abstract class metaextractor_Extractor
{
	protected $name = null;
	protected $supportedUrlPattern = null;

	/**
	 * Process a URL.
	 * @param string $url URL
	 * @param metaextractor_UrlContentFetcher $urlContentFetcher URL content fetcher instance
	 * @return metaextractor_Result[] Array of metadata results extracted from the URL
	 */
	public abstract function processUrl($url, $urlContentFetcher);
	
	/**
	 * Fetch the ID of the metadata extractor.
	 * @return string ID of the metadata extractor
	 */
	public function getId()
	{
		return get_class($this);
	}

	/**
	 * Fetch the name of the metadata extractor.
	 * @return string name of the metadata extractor
	 */
	public function getName()
	{
		return $this->name;
	}

	/**
	 * Fetch the supported URL pattern of the metadata extractor.
	 * @return string supported URL pattern of the metadata extractor (preg_match), null if it supports any URL
	 */
	public function getSupportedUrlPattern()
	{
		return $this->supportedUrlPattern;
	}
}